{{#*inline "content"}}
<form id="gallery-form" method="POST" action="{{action}}" enctype="multipart/form-data">
    <div>
        <label for="name">Name</label>
        <input type="text" name="name" id="name" title="Name" required> 
    </div>
    <div>
        <label for="description">Description</label>
        <input type="text" name="description" id="description" title="Description"> 
    </div>
    <div>
        <label for="file">File</label>
        <input type="file" name="file" id="file" title="File"> 
    </div>
    <input type="submit" value="Upload" title="Upload">
</form>
<script type="text/javascript">
(function() {
    var form = 
        document.getElementById("gallery-form");

    form.addEventListener("submit", function (e) {
        var name = form.elements.name; 
        var description = form.elements.description;
        var jsonInput = document.createElement("input");
        jsonInput.name = "json";
        jsonInput.type = "hidden"; 
        jsonInput.value = JSON.stringify({
            name: name.value
          , description: description.value
          , kind: 0
        }); 
        name.parentNode.insertBefore(jsonInput,name);
        name.parentNode.removeChild(name); 
        description.parentNode.removeChild(description); 
    },false);

})();
</script>
{{/inline}}
{{~> (parent)~}}
